package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.common.EntityType;
import com.chinasi.dao.BidBasicDao;
import com.chinasi.model.BidBasic;
import com.chinasi.service.BidBasicService;

@Service
public class BidBasicServiceImpl implements BidBasicService {

	/**
	 * BidBasicDAO
	 */
	@Autowired
	private BidBasicDao bidBasicDao;
	
	@Override
	public Pager findPage(int currentPage) {
		Pager pager = new Pager(bidBasicDao.getTotalCount(new BidBasic()),currentPage);
		pager.setData(bidBasicDao.findByCondition(new BidBasic(), pager.getStartRow(), pager.getPageSize()));
		return pager;
	}

	@Override
	public Pager findRelationByIndustry(String industry,int currentPage) {
		BidBasic searchBean = new BidBasic();
		searchBean.setBidIndustry(industry);
		Pager pager = new Pager(bidBasicDao.getTotalCount(searchBean),currentPage);
		pager.setData(bidBasicDao.findByCondition(searchBean, pager.getStartRow(), pager.getPageSize()));
		return pager;
	}

	@Override
	public Integer findTotalCount() {
		return bidBasicDao.getTotalCount(new BidBasic());
	}

	@Override
	public BidBasic findById(String id) {
		return bidBasicDao.findByPK(id, BidBasic.class);
	}
	
	
	
}
